package cn.lxb.web.starter.template.sequence;

import cn.lxb.web.starter.template.helper.RandomHelper;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * 序列号助手
 *
 * @author 54lxb
 * @since 2019-11-20
 *
 */
public class SerialNumber {

    private static final DateTimeFormatter SIMPLE_DATE_FORMAT = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");

    private SerialNumber() {
    }

    /**
     * 创建序列号
     *
     * @return 序列号
     */
    public static String createSn() {
        return LocalDateTime.now().format(SIMPLE_DATE_FORMAT) + (RandomHelper.nextInt(900) + 100);
    }

}
